package com.goldsprite.microhorigame.screens.examples.spinegfsmexamples;

import java.util.HashMap;
import java.util.Map;

public class CharacterConfig {
	public String dataPath;
	public Map<AnimType, String> animations; // 直接使用枚举作为Key
	public float scale;
	public float yOffset;

	public CharacterConfig() {
		this.animations = new HashMap<>();
	}

	// 链式配置方法
	public CharacterConfig setDataPath(String dataPath) {
		this.dataPath = dataPath;
		return this;
	}

	public CharacterConfig setScale(float scale) {
		this.scale = scale;
		return this;
	}

	public CharacterConfig setYOffset(float yOffset) {
		this.yOffset = yOffset;
		return this;
	}

	public CharacterConfig addAnim(AnimType type, String animationName) {
		this.animations.put(type, animationName);
		return this;
	}

	public String getAnimName(AnimType type) {
		return this.animations.get(type);
	}
	public String getAnimNameOrDefault(AnimType type,  String defaultValue) {
		return this.animations.getOrDefault(type, defaultValue);
	}

	// 便捷获取方法 - 现在直接返回动画名称
	public String getIdleAnimation() {
		return getAnimNameOrDefault(AnimType.IDLE, "idle");
	}

	public String getRunAnimation() {
		return getAnimNameOrDefault(AnimType.MOVE, "run");
	}

	public String getAttackAnimation() {
		return getAnimNameOrDefault(AnimType.ATTACK, "attack");
	}

	public String getJumpAnimation() {
		return getAnimName(AnimType.JUMP); // 返回null表示没有跳跃动画
	}

	// Getter 方法保持不变
	public String getJsonPath() {
		return dataPath + ".json";
	}

	public String getAtlasPath() {
		return dataPath + ".atlas";
	}
}
